<template>
  <div class="cart">
    <div class="cart-nav" style="height: 41px">
      <div class="cart-box">
        <span class="left">购物车</span>
        <div class="right">
          <div class="cart-coupon withSpecialIcon">
            <span class="specailIcon">领券</span>
          </div>
          <span class="cart-btn">编辑</span>
        </div>
      </div>
    </div>
    <!-- 购物车未添加显示的页面 -->
    <div class="box" v-if="commodity">
      <ul class="cart-title">
        <li class="item">
          <i class="u-icon u-icon-servicePolicy"></i><span>30天无忧退货</span>
        </li>
        <li class="item">
          <i class="u-icon u-icon-servicePolicy"></i><span>48小时快速退款</span>
        </li>
        <li class="item">
          <i class="u-icon u-icon-servicePolicy"></i><span>满99元免邮费</span>
        </li>
      </ul>
    </div>
    <van-empty
      v-if="commodity"
      class="custom-image"
      image="https://yanxuan-static.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noCart-d6193bd6e4.png?imageView&type=webp"
      description="去添加点什么吧"
    />
    <!-- 加入购物车传过来的数据显示的页面 -->
    <add-card v-if="cardList"></add-card>
  </div>
</template>

<script>
import AddCard from "./AddCart.vue";
export default {
  data() {
    return {
      commodity: false,
      cardList: [], // 加入购物车传过来的数据
    };
  },
  components: {
    AddCard,
  },
};
</script>

<style lang="less" scoped>
.cart {
  .cart-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    .cart-box {
      height: 54.53px;
      padding: 0 19.95px;
      line-height: 54.53px;
      text-align: center;
      background-color: #fff;
      position: relative;
      .left {
        float: left;
        font-size: 21.28px;
      }
      .right {
        position: absolute;
        top: 0;
        right: 15.96px;
        height: 54.53px;
        font-size: 18.62px;
        .cart-coupon {
          display: inline-block;
          position: relative;
          height: 54.53px;
          line-height: 54.53px;
          color: #dd1a21;
          margin-right: 18.62px;
          box-sizing: border-box;
          
          .specailIcon {
            color: #fff;
            position: absolute;
            left: 50%;
            top: 13.33px;
            line-height: 15.96px;
            transform: translate(-50%, 0);
            padding: 2.66px 7.98px;
            background-image: linear-gradient(-45deg, #fc865f 0, #fc625f 100%);
            border-radius: 2.66px;
            white-space: nowrap;
            box-sizing: border-box;
          }
        }
      }
      :after {
        content: "";
        position: absolute;
        background-color: #d9d9d9;
        left: 0;
        width: 100%;
        height: 1.33px;
        transform-origin: 50% 100% 0;
        bottom: 0;
      }
    }
  }
  .box {
    position: relative;
    top: 53.2px;
    .cart-title {
      top: 54.53px;
      height: 43.89px;
      line-height: 43.89px;
      padding: 0 15.96px;
      background: #eee;
      display: flex;
      justify-content: space-between;
      .item {
        font-size: 11.97px;
        color: #666;
      }
    }
  }

  .van-empty {
    position: absolute;
    top: 25%;
    left: 25%;
  }
}
</style>